let pagesConfig = require("./page.config.js");
const path = require("path");
module.exports = {
  publicPath: "/",
  outputDir: process.env.VUE_APP_OUTPUTDIR,
  assetsDir: "assets",
  productionSourceMap: false,
  pages: pagesConfig,
  devServer: {
    open: true,
    index: "/demo.html",
    port: 10002, // 端口
    compress: true,
    disableHostCheck: true, //webpack4.0 开启热更新
    https: false, // 启用https
    overlay: {
      warnings: false,
      errors: false
    }, // 错误、警告在页面弹出

    proxy: {
      "/socket.io": {
        target: process.env.VUE_APP_SERVERURL,
        ws: true,
        changeOrigin: true
      },
      "sockjs-node": {
        target: process.env.VUE_APP_SERVERURL,
        ws: false,
        changeOrigin: true
      }
    }
  },
  configureWebpack: () => {
    return {
      resolve: {
        alias: {
          api: "@/api",
          demo: "@/pages/demo"
        }
      }
    };
  },
  chainWebpack: config => {
    config.cache(true);
  },
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "scss",
      patterns: [
        path.resolve(__dirname, "./src/styles/varibles.scss"),
        path.resolve(__dirname, "./src/styles/varibles-class.scss")
      ]
    }
  }
};
